﻿@using SDF.Plugin.Misc.DynamicEntity.Domain.Enums
@using SDF.Services
@using SDF.Core.Domain.Catalog

@model  SDF.Plugin.Misc.DynamicEntity.Models.DynamicEntityHeaderModel

@{
    //page title
    ViewBag.Title = T("Plugins.Misc.DynamicEntity.Edit").Text;
    //active menu item (system name)
    //Html.SetActiveMenuItemSystemName("DynamicEntity");

    var defaultGridPageSize = EngineContext.Current.Resolve<SDF.Core.Domain.Common.AdminAreaSettings>().DefaultGridPageSize;
    var gridPageSizes = EngineContext.Current.Resolve<SDF.Core.Domain.Common.AdminAreaSettings>().GridPageSizes;
}

@{
    Html.AddScriptParts("~/Plugins/SDF.Plugin.Misc.DynamicEntity/Scripts/JSLINQ.js");
}

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    <div class="content-header clearfix">
        <h1 class="pull-left">
            @Model.Name
            <small>
                <i class="fa fa-arrow-circle-left"></i>
                @Html.ActionLink(T("Plugins.Misc.DynamicEntity.BackToList").Text, "HeaderList")
            </small>
        </h1>
        <div class="pull-right">
            <button type="submit" name="save" class="btn bg-blue">
                <i class="fa fa-floppy-o"></i>
                @T("Admin.Common.Save")
            </button>
            <button type="submit" name="save-continue" class="btn bg-blue">
                <i class="fa fa-floppy-o"></i>
                @T("Admin.Common.SaveContinue")
            </button>
            <span id="header-delete" class="btn bg-red">
                <i class="fa fa-trash-o"></i>
                @T("Admin.Common.Delete")
            </span>
        </div>
    </div>
    <script>
        $(function () {
            $("#header-delete").click(function (e) {
                e.preventDefault();

                var postData = {headerId: @Model.Id}
                addAntiForgeryToken(postData);
            });
        });
    </script>
    @Html.Partial("~/Plugins/SDF.Plugin.Misc.DynamicEntity/Views/DynamicEntity/_CreateOrUpdateEntity.cshtml", Model)
}

@Html.DeleteConfirmation("DeleteHeader", "header-delete")